package com.ty.day5;

/**
 * Created by IntelliJ IDEA.
 * Author : txy
 * Create 2023/11/1 17:45
 */
public class Six {
    public static void main(String[] args) {
        int s = 1, day = 10;
        System.out.println("第" + day + "天有" + s + "个苹果");
        while (day > 1) {//天数。因为day会先减一，如果大于0会取到第0天，
            // 多一次循环，所以只取到1，
            day = day - 1;
            s = (s + 1) * 2;//吃一半多一个，说明前一天有 （当天的个数+1）*2个

            System.out.println("第" + day + "天有" + s + "个苹果");
        }
    }
}
